#!/usr/bin/python
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2011 zod.yslin
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 
# Author: zod.yslin
# Email: 
# File Name: string.py
# Description: 
# 
# Edit History: 
#   2011-07-28    File created.
#===============================================================================

def demo_split():
    print "abc   k@g.com".split()
    print "abc   k@g.com".split(' ')
    print "abc   k@g.com".split(' ', 1)
    [name, mail] = "abc   k@g.com".split()
    print name + ':' + mail

def demo_strip():
    print "line i\n\n\n".strip()  #delete all \n at the end of line
    
def main():
    print 'main'
    demo_split()
    #demo_strip()
    
    str = "this is string example....wow!!!";
    print str.ljust(50, '1');
    print str.rjust(50, '1');
    print str.zfill(50);
    print str[0:3]
    print str[0:len(str)-2]
    

if __name__=='__main__':
    main()
